Skip to content

feat(search-bar): Add consent flow to Ask Seer #95406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

nsdeschenes
Copy link
Contributor

This PR adds in the consent flow for Ask Seer, as well as the associated tests for these changes. This enables users to turn on Ask Seer to help them generate queries while searching on the explore/traces page.

Ticket: AIML-704

@nsdeschenes nsdeschenes requested review from aayush-se and roaga July 13, 2025 18:39
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 13, 2025
Copy link

codecov bot commented Jul 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #95406   +/-   ##
=======================================
  Coverage   86.50%   86.50%           
=======================================
  Files       10563    10563           
  Lines      608782   608753   -29     
  Branches    23912    23908    -4     
=======================================
- Hits       526614   526591   -23     
+ Misses      81873    81868    -5     
+ Partials      295      294    -1     

@nsdeschenes nsdeschenes requested a review from malwilley July 14, 2025 06:01
@nsdeschenes nsdeschenes marked this pull request as ready for review July 14, 2025 06:56
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@nsdeschenes
Copy link
Contributor Author

Bug: Ask Seer Options Incorrectly Displayed

The useHiddenItems logic in combobox.tsx incorrectly hides only one of the Ask Seer options (ASK_SEER_ITEM_KEY or ASK_SEER_CONSENT_ITEM_KEY) based on the gaveSeerConsent status. Both of these options should always be hidden from the main list of results, as the appropriate Ask Seer prompt is rendered separately by the AskSeer component. This can lead to the wrong Ask Seer option appearing as a duplicate in the main list.

static/app/components/searchQueryBuilder/tokens/combobox.tsx#L193-L200
Fix in CursorFix in Web

Was this report helpful? Give feedback by reacting with 👍 or 👎

This is incorrect, and actually caused a bug.

const openState = isOpen ?? state.isOpen;

if (hasCustomMenu) {
  return openState;
}

// When a custom menu is not being displayed and we aren't loading anything,
// only show when there is something to select from.
return openState && totalOptions > hiddenOptions.size;

We need to only add one of the two, or else when searching free text, the condition will never be met properly. I attempted to switch from > to >= however this raised issues when free text is not allowed.

@nsdeschenes nsdeschenes force-pushed the nd/AIML-704/feat-add-consent-flow-to-trace-ask-seer branch from 2a0d2b3 to b499912 Compare July 14, 2025 11:32
cursor[bot]

This comment was marked as outdated.

Copy link
Member

@roaga roaga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also should not be showing any Seer UI, not even the consent entry point, if organization.hideAiFeatures is true

{
dataProcessingPolicy: (
<TooltipSubExternalLink
onMouseOver={() => setOptionDisableOverride(true)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you disabling to prevent the click here from propagating to the option?

In other areas, I've added stopPropagation to the necessary handlers to prevent the click from going through:

<TrailingWrap
onPointerUp={e => e.stopPropagation()}
onMouseUp={e => e.stopPropagation()}
onClick={e => e.stopPropagation()}
>

Copy link
Contributor Author

@nsdeschenes nsdeschenes Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly. The reason why this is needed is because of the logic that lives inside these lines: https://github.com/getsentry/sentry/blob/nd/AIML-704/feat-add-consent-flow-to-trace-ask-seer/static/app/components/searchQueryBuilder/tokens/filterKeyListBox/useFilterKeyListBox.tsx#L388-L404, there doesn't seem to be any way to access the event in this handler, so can't call stopPropagation, there it would seem

As the onClick handler in askSeer.tsx isn't used.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can still add onMouseUp={e => e.stopPropagation()} (and others if necessary) to the <TooltipSubExternalLink> though right? That would prevent the option from being selected when you click the link

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No that doesn't work annoyingly, it's still triggering the option via useFilterKeyListBox

@nsdeschenes
Copy link
Contributor Author

You also should not be showing any Seer UI, not even the consent entry point, if organization.hideAiFeatures is true

Yep, any cases of where <AskSeer> is being called is checked to see if enableAiSearch is true, which does check to ensure that organization.hideAiFeatures is false.

https://github.com/getsentry/sentry/blob/nd/AIML-704/feat-add-consent-flow-to-trace-ask-seer/static/app/components/searchQueryBuilder/context.tsx#L107-L108

cursor[bot]

This comment was marked as outdated.

@nsdeschenes nsdeschenes force-pushed the nd/AIML-704/feat-add-consent-flow-to-trace-ask-seer branch from d3bd864 to 4eb8681 Compare July 16, 2025 17:33
cursor[bot]

This comment was marked as outdated.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Ask Seer Options Incorrectly Displayed

The useHiddenItems hook in combobox.tsx incorrectly hides only one of the Ask Seer options (ASK_SEER_ITEM_KEY or ASK_SEER_CONSENT_ITEM_KEY) based on the gaveSeerConsent status. Both options should always be hidden from the main dropdown list, as the appropriate Ask Seer prompt is rendered separately by the AskSeer component. This causes the wrong Ask Seer option to appear as a duplicate in the main results list.

static/app/components/searchQueryBuilder/tokens/combobox.tsx#L192-L200

);
if (showAskSeerOption) {
if (gaveSeerConsent) {
options.add(ASK_SEER_ITEM_KEY);
} else {
options.add(ASK_SEER_CONSENT_ITEM_KEY);
}
}

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@nsdeschenes nsdeschenes requested a review from malwilley July 16, 2025 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants